/*
	created time:2018/4/8
	author:Chason
	describe:开始游戏界面头部
*/
class PassGameHeader  extends egret.DisplayObjectContainer{
	public constructor() {
		super();
		this.init();
		//监听添加到显示列表
		this.addEventListener(egret.Event.ADDED_TO_STAGE,()=>{
           this.start();         
        }, this);	
	}
	private  stageWidth=egret.MainContext.instance.stage.stageWidth;
	private  stageHeight=egret.MainContext.instance.stage.stageHeight;


	/*
		头部显示对象
	*/
	private header;

	/*
		初始化
	*/
	private headerHeight:number=80;

	private init():void{
	  //头部背景
	  let shp:egret.Shape=new egret.Shape();
	  shp.graphics.beginFill(0xffffff,0.05);
	  shp.graphics.drawRect(0,0,this.stageWidth,this.headerHeight);
	  shp.graphics.endFill();
	  this.addChild(shp);
	  //退出房间箭头
	  let back:egret.Bitmap=new egret.Bitmap();
	  back.texture=RES.getRes("home_json.back");
	  back.scaleX=0.8;
	  back.x=50;
	  back.y=10;
	  back.touchEnabled=true;
	  //箭头事件--场景返回到
	  back.addEventListener(egret.TouchEvent.TOUCH_TAP,()=>{
		   Scene.main.removeChild(Scene.passGame);
           Scene.passGame = null;
           Scene.main.addChild(Game.getInstance());
	  },this);
	  this.addChild(back);
	}


	 public start():void{
		 //头部动画
		let headTW=egret.Tween.get(this);
	    headTW.to({y:-this.headerHeight})
		     .to({y:0},600,egret.Ease.backOut);
	 }
}